<template>
  <div>
    <div class="title">
      <el-row>
        <el-col :span="1" style="width: 50px;">
          <span style="color:#757575;">位置 : </span>
        </el-col>
        <el-col :span="20">
          <span class="textactive">工作统计表</span>
        </el-col>
      </el-row>
    </div>
    <div class="posttable workstatistics">
      <el-row type="flex" justify="center" style="height: 50px;
    line-height: 50px;background-color: #fff;">
        <el-col :span="23">
          <div style="float: left;width: 50%;">
            <el-row>
              <el-col :span="20" class="interviewtrack">
                <el-date-picker
                  style="margin-right: 5px;"
                  v-model="time"
                  type="date"
                  placeholder="请选择时间"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  :picker-options="pickerOptions"
                  @change="selectTime"
                >
                </el-date-picker>
                <el-select
                  v-model="name"
                  placeholder="请选择专员"
                  v-if="namelist.length !== 0"
                  @change="selectTime"
                >
                  <el-option v-for="(item,index) in namelist" :key="index" :label="item" :value="item">
                  </el-option>
                </el-select>
              </el-col>
            </el-row>
          
          
          </div>
        </el-col>
      </el-row>
      <el-row type="flex" justify="center" style="background-color: #fff;">
        <el-col :span="23">
          <el-table
            ref="singleTable"
            :data="tableData"
          >
            <el-table-column
              width="50"
              prop="sid"
              label="编号"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="isPush"
              label="推送"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="isDown"
              label="下载">
            </el-table-column>
            <el-table-column
              width="100"
              prop="customerName"
              label="推送客户">
            </el-table-column>
            <el-table-column
              width="100"
              prop="origin"
              label="简历来源">
            </el-table-column>
            <el-table-column
              width="50"
              prop="sex"
              label="性别"
            >
            </el-table-column>
            <el-table-column
              width="100"
              prop="name"
              label="姓名"
            >
            </el-table-column>
            <el-table-column
              width="120"
              prop="phone"
              label="联系方式"
            >
            </el-table-column>
            <el-table-column
              width="200"
              prop="mail"
              label="邮箱"
            >
            </el-table-column>
            <el-table-column
              width="160"
              prop="postName"
              label="面试职位"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="postLevel"
              label="级别"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="status"
              label="状态"
            >
            </el-table-column>
            <el-table-column
              prop="currentSalary"
              label="当前薪资"
            >
              <template slot-scope="scope">
                {{scope.row.currentSalary}}
              </template>
            </el-table-column>
            <el-table-column
              prop="exSalary"
              label="期望薪资"
            >
            </el-table-column>
            <el-table-column
              prop="miniSalary"
              label="最低薪资"
            >
            </el-table-column>
            <el-table-column
              prop="entryTime"
              label="到岗时间"
            >
            </el-table-column>
            <el-table-column
              prop="initialEvaluation"
              label="初步评价"
              show-overflow-tooltip
            >
            </el-table-column>
          </el-table>
          
          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="pagehandleCurrentChange"
              :current-page="currentPage"
              :page-sizes="[5,10,15]"
              :page-size="pagesize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      
      <el-row type="flex" justify="center" style="background-color: #fff;margin-top: 10px;">
        <el-col :span="23">
          <span style="color: #333333;height: 40px;line-height: 40px;font-weight: 700;font-size: 16px;">预约情况统计表</span>
          <el-table
            ref="singleTable"
            :data="tableData1"
          >
            <el-table-column
              width="50"
              prop="sid"
              label="编号"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="isDown"
              label="下载">
            </el-table-column>
            <el-table-column
              width="100"
              prop="customerName"
              label="推送客户">
            </el-table-column>
            <el-table-column
              width="100"
              prop="origin"
              label="简历来源">
            </el-table-column>
            <el-table-column
              width="50"
              prop="sex"
              label="性别"
            >
            </el-table-column>
            <el-table-column
              width="100"
              prop="name"
              label="姓名"
            >
            </el-table-column>
            <el-table-column
              width="120"
              prop="phone"
              label="联系方式"
            >
            </el-table-column>
            <el-table-column
              width="200"
              prop="mail"
              label="邮箱"
            >
            </el-table-column>
            <el-table-column
              width="160"
              prop="postName"
              label="面试职位"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="postLevel"
              label="级别"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="status"
              label="状态"
            >
            </el-table-column>
            <el-table-column
              prop="feedTime"
              label="反馈时间"
            >
            </el-table-column>
            <el-table-column
              prop="orderInterview"
              label="预约面试时间"
            >
            </el-table-column>
            <el-table-column
              prop="initialEvaluation"
              label="初步评价"
              show-overflow-tooltip
            >
            </el-table-column>
          </el-table>
          
          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange1"
              @current-change="pagehandleCurrentChange1"
              :current-page="currentPage1"
              :page-sizes="[5,10,15]"
              :page-size="pagesize1"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount1"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      
      
      <el-row type="flex" justify="center" style="background-color: #fff;margin-top: 10px;">
        <el-col :span="23">
          <span style="color: #333333;height: 40px;line-height: 40px;font-weight: 700;font-size: 16px;">面试情况统计表</span>
          <el-table
            ref="singleTable"
            :data="tableData2"
          >
            <el-table-column
              width="50"
              prop="sid"
              label="编号"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="isDown"
              label="下载"
            >
            </el-table-column>
            <el-table-column
              width="100"
              prop="customerName"
              label="推送客户">
            </el-table-column>
            <el-table-column
              width="100"
              prop="origin"
              label="简历来源">
            </el-table-column>
            <el-table-column
              width="50"
              prop="sex"
              label="性别"
            >
            </el-table-column>
            <el-table-column
              width="100"
              prop="name"
              label="姓名"
            >
            </el-table-column>
            <el-table-column
              width="120"
              prop="phone"
              label="联系方式"
            >
            </el-table-column>
            <el-table-column
              width="200"
              prop="mail"
              label="邮箱"
            >
            </el-table-column>
            <el-table-column
              width="160"
              prop="postName"
              label="面试职位"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="postLevel"
              label="级别"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="status"
              label="状态"
            >
            </el-table-column>
            <el-table-column
              label="实际面试时间"
            >
              <template slot-scope="scope">
                <span>{{scope.row.actualTime | converTime("YYYY-MM-DD HH:mm:ss")}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="trackResult"
              label="面试跟踪"
            >
            </el-table-column>
          </el-table>
          
          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange2"
              @current-change="pagehandleCurrentChange2"
              :current-page="currentPage2"
              :page-sizes="[5,10,15]"
              :page-size="pagesize2"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount2"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      
      
      <el-row type="flex" justify="center" style="background-color: #fff;margin-top: 10px;margin-bottom: 10px;">
        <el-col :span="23">
          <span style="color: #333333;height: 40px;line-height: 40px;font-weight: 700;font-size: 16px;">二面情况统计表</span>
          <el-table
            ref="singleTable"
            :data="tableData3"
          >
            <el-table-column
              width="50"
              prop="sid"
              label="编号"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="isDown"
              label="下载">
            </el-table-column>
            <el-table-column
              width="100"
              prop="customerName"
              label="推送客户">
            </el-table-column>
            <el-table-column
              width="100"
              prop="origin"
              label="简历来源">
            </el-table-column>
            <el-table-column
              width="50"
              prop="sex"
              label="性别"
            >
            </el-table-column>
            <el-table-column
              width="100"
              prop="name"
              label="姓名"
            >
            </el-table-column>
            <el-table-column
              width="120"
              prop="phone"
              label="联系方式"
            >
            </el-table-column>
            <el-table-column
              width="200"
              prop="mail"
              label="邮箱"
            >
            </el-table-column>
            <el-table-column
              width="160"
              prop="postName"
              label="面试职位"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="postLevel"
              label="级别"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="status"
              label="状态"
            >
            </el-table-column>
            <el-table-column
              label="实际面试时间"
            >
              <template slot-scope="scope">
                <span>{{scope.row.actualTime | converTime("YYYY-MM-DD HH:mm:ss")}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="trackResult"
              label="二面跟踪"
            >
            </el-table-column>
          </el-table>
          
          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange3"
              @current-change="pagehandleCurrentChange3"
              :current-page="currentPage3"
              :page-sizes="[5,10,15]"
              :page-size="pagesize3"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount3"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      
      
      <el-row type="flex" justify="center" style="background-color: #fff;margin-top: 10px;margin-bottom: 10px;">
        <el-col :span="23">
          <span style="color: #333333;height: 40px;line-height: 40px;font-weight: 700;font-size: 16px;">三面情况统计表</span>
          <el-table
            ref="singleTable"
            :data="tableData4"
          >
            <el-table-column
              width="50"
              prop="sid"
              label="编号"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="isDown"
              label="下载">
            </el-table-column>
            <el-table-column
              width="100"
              prop="customerName"
              label="推送客户">
            </el-table-column>
            <el-table-column
              width="100"
              prop="origin"
              label="简历来源">
            </el-table-column>
            <el-table-column
              width="50"
              prop="sex"
              label="性别"
            >
            </el-table-column>
            <el-table-column
              width="100"
              prop="name"
              label="姓名"
            >
            </el-table-column>
            <el-table-column
              width="120"
              prop="phone"
              label="联系方式"
            >
            </el-table-column>
            <el-table-column
              width="200"
              prop="mail"
              label="邮箱"
            >
            </el-table-column>
            <el-table-column
              width="160"
              prop="postName"
              label="面试职位"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="postLevel"
              label="级别"
            >
            </el-table-column>
            <el-table-column
              width="50"
              prop="status"
              label="状态"
            >
            </el-table-column>
            <el-table-column
              label="实际面试时间"
            >
              <template slot-scope="scope">
                <span>{{scope.row.actualTime | converTime("YYYY-MM-DD HH:mm:ss")}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="trackResult"
              label="三面跟踪"
            >
            </el-table-column>
          </el-table>
          
          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange4"
              @current-change="pagehandleCurrentChange4"
              :current-page="currentPage4"
              :page-sizes="[5,10,15]"
              :page-size="pagesize4"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount4"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
  import moment from 'moment'
  import axios from 'axios'
  
  export default {
    name: "workstatistics",
    data() {
      return {
        time: moment(new Date()).format('YYYY-MM-DD'),
        name: '',
        namelist: [],
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() > Date.now();
          },
        },
        tableData: [],
        totalcount: null,
        currentPage: 1,
        pagesize: 5,
        tableData1: [],
        totalcount1: null,
        currentPage1: 1,
        pagesize1: 5,
        tableData2: [],
        totalcount2: null,
        currentPage2: 1,
        pagesize2: 5,
        tableData3: [],
        totalcount3: null,
        currentPage3: 1,
        pagesize3: 5,
        tableData4: [],
        totalcount4: null,
        currentPage4: 1,
        pagesize4: 5,
      }
    },
    created() {
      axios.post(this.url + '/workstatistics/isManager').then(res => {
        this.unlogin(res.data.code);
        if (res.data.code == 200) {
          this.namelist = res.data.data;
          if (this.namelist.length !== 0) {
            this.name = "汪霞"
          } else {
            this.name = ''
          };
          this.selectTime();
        }
      })
    },
    methods: {
      selectTime() {
        this.getWSFByName();
        this.getWSFSe();
        this.getWSFThByZY();
        this.getWSFThThreeByZY();
        this.getWSFThTwoByZY();
      },
      getWSFByName() {
        axios.post(this.url + '/workstatistics/getWSFByName', {
          name: this.name,
          time: this.time,
          pageNum: this.currentPage,
          pageSize: this.pagesize
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData = res.data.data.list;
            this.totalcount = res.data.data.total;
          }
        });
      },
      //预计情况统计表
      getWSFSe() {
        axios.post(this.url + '/workstatistics/getWSFSe', {
          name: this.name,
          time: this.time,
          pageNum: this.currentPage1,
          pageSize: this.pagesize1
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData1 = res.data.data.list;
            this.totalcount1 = res.data.data.total;
          }
        });
      },
      //面试情况统计表
      getWSFThByZY() {
        axios.post(this.url + '/workstatistics/getWSFThByZY', {
          name: this.name,
          time: this.time,
          pageNum: this.currentPage2,
          pageSize: this.pagesize2
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData2 = res.data.data.list;
            this.totalcount2 = res.data.data.total;
          }
        });
      },
      //二面情况统计表
      getWSFThTwoByZY() {
        axios.post(this.url + '/workstatistics/getWSFThTwoByZY', {
          name: this.name,
          time: this.time,
          pageNum: this.currentPage3,
          pageSize: this.pagesize3
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData3 = res.data.data.list;
            this.totalcount3 = res.data.data.total;
          }
        });
      },
      //三面情况统计表
      getWSFThThreeByZY() {
        axios.post(this.url + '/workstatistics/getWSFThThreeByZY', {
          name: this.name,
          time: this.time,
          pageNum: this.currentPage4,
          pageSize: this.pagesize4
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData4 = res.data.data.list;
            this.totalcount4 = res.data.data.total;
          }
        });
      },
      //修改表格分页的展示条数
      handleSizeChange(val) {
        this.pagesize = val;
        this.getWSFByName();
      },
      //修改表格分页的当前页
      pagehandleCurrentChange(val) {
        this.currentPage = val;
        this.getWSFByName();
      },
      //预约情况统计表
      handleSizeChange1(val) {
        this.pagesize1 = val;
        this.getWSFSe();
      },
      pagehandleCurrentChange1(val) {
        this.currentPage1 = val;
        this.getWSFSe();
      },
      //面试情况统计表
      handleSizeChange2(val) {
        this.pagesize2 = val;
        this.getWSFThByZY();
      },
      pagehandleCurrentChange2(val) {
        this.currentPage2 = val;
        this.getWSFThByZY();
      },
      //二面情况统计表
      handleSizeChange3(val) {
        this.pagesize3 = val;
        this.getWSFThTwoByZY();
      },
      pagehandleCurrentChange3(val) {
        this.currentPage3 = val;
        this.getWSFThTwoByZY();
      },
      //三面情况统计表
      handleSizeChange4(val) {
        this.pagesize4 = val;
        this.getWSFThThreeByZY();
      },
      pagehandleCurrentChange4(val) {
        this.currentPage4 = val;
        this.getWSFThThreeByZY();
      },
    }
  }
</script>

<style scoped>
  .title {
    background-color: #fff;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    padding-left: 20px;
    margin-top: 6px;
    margin-bottom: 6px;
  }
  
  .textactive {
    color: #1099ff;
  }
  
  .posttable {
    min-height: 700px;
  }
  
  .pager {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  .el-pagination {
    margin-left: 50%;
    transform: translateX(-50%);
  }
</style>
